﻿CREATE PROCEDURE [dbo].[Text_BookTree_Element]
	@bookTreeId BIGINT,
	@url NVARCHAR(450)
AS
BEGIN
	SELECT t.[Text]
	FROM [dbo].[text_BookTree] AS t
	INNER JOIN [dbo].[text_BookTree] AS p ON p.[BookTreeId] = t.[ParentBookTreeId]
	INNER JOIN [dbo].[text_BookTree_Cache] AS c ON p.[BookTreeId] = c.[BookTreeId]
	WHERE t.[BookTreeId] = @bookTreeId AND c.[Url] = @url
END